package cn.tedu.com.bean;

import cn.tedu.com.enums.UserBaseRelation;
import cn.tedu.com.enums.UserRole;
import lombok.Data;

import java.io.Serializable;
import java.sql.Timestamp;

/**
 * <p>
 *
 * </p>
 *
 * @author zhaoyue1
 * @Description
 * @since 2021-05-14
 */
@Data
public class UserInfo implements Serializable {
    private Long id;
    private String name;
    private String userPassWord;
    private String phone;
    private UserRole userRole;
    private UserBaseRelation userBaseRelation;
    private String username;
    private String url;
    private String password;
    private Timestamp timestamp;


    public UserInfo(String name, String phone, UserRole userRole, UserBaseRelation userBaseRelation, String username, String url, String password) {
        this.name = name;
        this.phone = phone;
        this.userRole = userRole;
        this.userBaseRelation = userBaseRelation;
        this.username = username;
        this.url = url;
        this.password = password;
    }

    public UserInfo() {
        System.out.println("11111111111");
    }


    public void setUserBaseRelation(Object userBaseRelation) {
        if(userBaseRelation instanceof Integer){
            this.userBaseRelation = UserBaseRelation.getEnum((Integer) userBaseRelation);
        }else{
            this.userBaseRelation=UserBaseRelation.valueOf((String)userBaseRelation);
        }

    }

    public void setUserRole(Object userRole) {
        if(userRole instanceof Integer){
            this.userRole = UserRole.getEnum((Integer) userRole);
        }else{
            this.userRole=UserRole.valueOf((String) userRole);
        }

    }
}
